package com.forfunnet.minjian.ui;

import android.content.Intent;
import android.os.Handler;

import com.forfunnet.minjian.R;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EActivity;

/**
 * Created by RexQian on 4/3/16.
 */
@EActivity(R.layout.activity_launch)
public class LaunchActivity extends BaseActivity {
    @AfterViews
    void init() {
        new Handler().postDelayed(new Runnable() {
            public void run() {
                String lastVersion = mApp.pref().lastVersion().get();
                String curVersion = mApp.getVersion();
                if (curVersion.equals(lastVersion)) {
                        MainActivity_.intent(LaunchActivity.this).start();
                }
                else {
                    mApp.pref().edit().lastVersion().put(curVersion).apply();
                    Intent intent = new Intent(LaunchActivity.this, GuideActivity_.class);
                    LaunchActivity.this.startActivity(intent);
                }
                LaunchActivity.this.finish();
            }
        }, 1500);
    }
}
